<?php


namespace app\api\controller\xiluedu;


use app\common\controller\Api;
use app\common\model\xiluedu\Singlepage AS SinglepageModel;

class Singlepage extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 文章详情
     * @throws \think\exception\DbException
     */
    public function article(){
        $biaoshi = $this->request->param('biaoshi');
        if(!$biaoshi){
            $this->error('非法参数');
        }
        $row = SinglepageModel::where('mark',$biaoshi)
            ->find();
        $this->success('查询成功',$row);
    }

    /**
     * 配置文章
     */
    public function config_page(){
        $config = \app\common\model\xiluedu\Config::getMyConfig('shopinfo');
        $user_agreement = $config['user_agreement'] ? SinglepageModel::get($config['user_agreement']) : [];
        $privacy_agreement = $config['privacy_agreement'] ? SinglepageModel::get($config['privacy_agreement']) : [];

        $this->success('查询成功',['user_agreement'=>$user_agreement,'privacy_agreement'=>$privacy_agreement]);
    }

}